from scipy import linalg
import numpy as np

A = np.matrix([[1, -2, 1], [0, 2, -8], [-4, 5, 9]])
print(A)
print(linalg.det(A))  # 行列式的值，不为0才有逆

C1 = np.matrix([0, 8, -9])
C = C1.T
print(C)

A_inv = linalg.inv(A)
print(A_inv)

B = A_inv @ C  # 矩阵乘法用@，
# 逐元素乘法用*，矩阵的哈达玛积(hadamard product)：两个相乘的矩阵维度一致，逐元素相乘（也叫矩阵点乘，element-wise product ,entrywise product ）
print(B)

print(A @ B)
